home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / src / commands / update.c < prev    next >
C/C++ Source or Header  |  1990-07-23  |  576b  |  35 lines

  1. /* update - do sync periodically        Author: Andy Tanenbaum */
  2.  
  3. #include <sys/types.h>
  4. #include <signal.h>
  5.  
  6. main()
  7. {
  8.   int fd, buf[2];
  9.  
  10.  
  11.   /* Disable SIGTERM */
  12.   signal(SIGTERM, SIG_IGN);
  13.  
  14.   /* Release all (?) open file descriptors. */
  15.   close(0);
  16.   close(1);
  17.   close(2);
  18.  
  19.   /* Release current directory to avoid locking current device. */
  20.   chdir("/");
  21.  
  22.   /* Open some files to hold their inodes in core. */
  23. /*open("/bin", 0);*/
  24. /*open("/lib", 0);*/
  25. /*open("/etc", 0);*/
  26. /*open("/tmp", 0);*/
  27.  
  28.  
  29.   /* Flush the cache every 30 seconds. */
  30.   while (1) {
  31.     sync();
  32.     sleep(30);
  33.   }
  34. }
  35.